import React,{Component} from 'react';
import HeadBack from '../../components/headBack';
import ImgList from '../../components/imgList';
import './style.scss';
import {getItemClass} from '../../utils/localData';
import {getClassName} from '../../utils/localData/type';
import {Route} from "react-router-dom";
import connectRoute from "../../utils/connectRoute";
import Detail from "../detail";
const HDetail = connectRoute(Detail);
export default class extends Component{
    constructor(props){
        super(props)
    }
    clickItem(id){
        this.props.history.push(this.props.match.url+'/detail/'+id);
    }
    render() {
        const id=this.props.match.params.id;
        console.log(this.props)
        return <div className={'itemClass'}>
            <HeadBack {...this.props} title={getClassName(id)}></HeadBack>
            <ImgList clickItem={this.clickItem.bind(this)} imgList={getItemClass(id)}></ImgList>
            <Route path={this.props.match.url+'/detail/:id'}  component={HDetail}/>
        </div>;
    }
}